home *** CD-ROM | disk | FTP | other *** search
/ Sky at Night 2007 June / SAN CD 6-2007 CD-ROM 25.iso / pc / Software / AstroGrav_Win / Java / jre1.6.0 / lib / rt.jar / java / awt / GraphicsConfiguration.class (.txt) < prev    next >
Encoding:
Java Class File  |  2006-11-29  |  2.8 KB  |  99 lines

  1. package java.awt;
  2.  
  3. import java.awt.geom.AffineTransform;
  4. import java.awt.image.BufferedImage;
  5. import java.awt.image.ColorModel;
  6. import java.awt.image.VolatileImage;
  7. import java.awt.image.WritableRaster;
  8. import java.util.Hashtable;
  9. import sun.awt.image.SunVolatileImage;
  10.  
  11. public abstract class GraphicsConfiguration {
  12.    private static BufferCapabilities defaultBufferCaps;
  13.    private static ImageCapabilities defaultImageCaps;
  14.  
  15.    protected GraphicsConfiguration() {
  16.    }
  17.  
  18.    public abstract GraphicsDevice getDevice();
  19.  
  20.    public abstract BufferedImage createCompatibleImage(int var1, int var2);
  21.  
  22.    public BufferedImage createCompatibleImage(int var1, int var2, int var3) {
  23.       if (this.getColorModel().getTransparency() == var3) {
  24.          return this.createCompatibleImage(var1, var2);
  25.       } else {
  26.          ColorModel var4 = this.getColorModel(var3);
  27.          if (var4 == null) {
  28.             throw new IllegalArgumentException("Unknown transparency: " + var3);
  29.          } else {
  30.             WritableRaster var5 = var4.createCompatibleWritableRaster(var1, var2);
  31.             return new BufferedImage(var4, var5, var4.isAlphaPremultiplied(), (Hashtable)null);
  32.          }
  33.       }
  34.    }
  35.  
  36.    public VolatileImage createCompatibleVolatileImage(int var1, int var2) {
  37.       VolatileImage var3 = null;
  38.  
  39.       try {
  40.          var3 = this.createCompatibleVolatileImage(var1, var2, (ImageCapabilities)null, 1);
  41.       } catch (AWTException var5) {
  42.          assert false;
  43.       }
  44.  
  45.       return var3;
  46.    }
  47.  
  48.    public VolatileImage createCompatibleVolatileImage(int var1, int var2, int var3) {
  49.       VolatileImage var4 = null;
  50.  
  51.       try {
  52.          var4 = this.createCompatibleVolatileImage(var1, var2, (ImageCapabilities)null, var3);
  53.       } catch (AWTException var6) {
  54.          assert false;
  55.       }
  56.  
  57.       return var4;
  58.    }
  59.  
  60.    public VolatileImage createCompatibleVolatileImage(int var1, int var2, ImageCapabilities var3) throws AWTException {
  61.       return this.createCompatibleVolatileImage(var1, var2, var3, 1);
  62.    }
  63.  
  64.    public VolatileImage createCompatibleVolatileImage(int var1, int var2, ImageCapabilities var3, int var4) throws AWTException {
  65.       SunVolatileImage var5 = new SunVolatileImage(this, var1, var2, var4, var3);
  66.       if (var3 != null && var3.isAccelerated() && !((VolatileImage)var5).getCapabilities().isAccelerated()) {
  67.          throw new AWTException("Supplied image capabilities could not be met by this graphics configuration.");
  68.       } else {
  69.          return var5;
  70.       }
  71.    }
  72.  
  73.    public abstract ColorModel getColorModel();
  74.  
  75.    public abstract ColorModel getColorModel(int var1);
  76.  
  77.    public abstract AffineTransform getDefaultTransform();
  78.  
  79.    public abstract AffineTransform getNormalizingTransform();
  80.  
  81.    public abstract Rectangle getBounds();
  82.  
  83.    public BufferCapabilities getBufferCapabilities() {
  84.       if (defaultBufferCaps == null) {
  85.          defaultBufferCaps = new DefaultBufferCapabilities(this.getImageCapabilities());
  86.       }
  87.  
  88.       return defaultBufferCaps;
  89.    }
  90.  
  91.    public ImageCapabilities getImageCapabilities() {
  92.       if (defaultImageCaps == null) {
  93.          defaultImageCaps = new ImageCapabilities(false);
  94.       }
  95.  
  96.       return defaultImageCaps;
  97.    }
  98. }
  99.